package cn.wolfcode.wolf2world.domain;

import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.HashMap;
import java.util.Map;

/**
 * 游记推荐
 */
@Setter
@Getter
@Document("banner")
public class Banner  extends BaseDomain {
    //正常
    public static final int STATE_NORMAL = 0;
    //禁用
    public static final int STATE_DISABLE = 1;
    //游记
    public static final int TYPE_TRAVEL = 1;
    //攻略
    public static final int TYPE_STRATEGY = 2;
    //关联id
    private String refId;
    //标题
    private String title;
    //副标题
    private String subTitle;
    //封面
    private String coverUrl;
    //状态
    private int state = STATE_NORMAL;
    //排序
    private int sequence;
    //类型（游记或攻略）
    private int type;

    public String getJsonString(){
        Map<String, Object> map = new HashMap<>();
        map.put("id",id);
        map.put("title",title);
        map.put("subTitle",subTitle);
        map.put("coverUrl",coverUrl);
        map.put("state",state);
        map.put("sequence",sequence);
        map.put("refId",refId);
        map.put("type",type);
        return JSON.toJSONString(map);
    }

    public String getStateDisplay(){
        return state == STATE_NORMAL?"正常":"禁用";
    }

    public String getTypeDisplay(){
        return type == TYPE_STRATEGY?"攻略":"游记";
    }
}